package cm.cool.web.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import cm.cool.web.bean.OrderDto;
import cm.cool.web.service.OrderService;

@RestController
@RequestMapping("/Order")
public class OrderController {
	@Autowired
	private OrderService orderService;

	@RequestMapping("/gotoOrderPage")
	public ModelAndView gotoOrderPage() {
		ModelAndView modelAndView = new ModelAndView("/payOrder");
		return modelAndView;
	}

	// 根据id查询
	@RequestMapping("/selectall")
	public Map<String, Object> selectall(Long id) {
		Map<String, Object> map = new HashMap<String, Object>();
		List<OrderDto> order = orderService.selectByPrimaryKey(id);
		map.put("code", 1);
		if (id != null || "".equals(id)) {
			map.put("code", 2);
		}
		return map;
	}

	@RequestMapping("/getOrderList")
	public Map<String,Object> getOrderList(){
		Map<String,Object> map = new HashMap<String,Object>();
		List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
	  return null;
	}
}